LCOS Multi-Spot Phase Pattern

This notebook shows how to call the function compute_pattern() to generate a multispot LCOS pattern with arbitrary input parameters.


In [1]:
import matplotlib.pyplot as plt
import matplotlib as mpl
%matplotlib inline
#%config InlineBackend.figure_format='retina'  # for hi-dpi displays

In [2]:
%run patternlib

Here we define the pattern parameters. For a description of each paramenter refer to the compute_pattern() documentation in patternlib.py.


In [3]:
d = {
 'Xm': [21, 21.72, 44.87, 68.2, 91.45, 114.72, 137.87, 160.97, 184.04],
 'Ym': [21.72, 44.87, 68.2, 91.45, 114.72, 137.87, 160.97, 184.04],
 'center_x': 0,
 'center_y': 0,
 'dark_all': False,
 'focal': 0.032,
 'grid': True,
 'ncols': 8,
 'nospot': False,
 'nrows': 1,
 'phase_factor': 85,
 'phase_max': 2.0,
 'phase_wrap_neg': True,
 'phase_wrap_pos': True,
 'pitch_x': 18,
 'pitch_y': 18,
 'ref_spot': 0,
 'ref_spot_dark': False,
 'rotation': 1,
 'spotsize': 30.0,
 'steer_horiz': True,
 'steer_lw': 2,
 'steer_pad': 4,
 'steer_vmax': 95,
 'test_pattern': False,
 'wavelen': 532e-09,
 'stretch': True}

We generate the pattern (a 2D array of unit8 values):


In [4]:
a = compute_pattern(**d)

and plot it:


In [5]:
fig, ax = plt.subplots(figsize=(8, 5))
im = plt.imshow(a, interpolation='none', cmap='magma',
                vmin=0, vmax=255)#, norm=mpl.colors.LogNorm(1, 255))
plt.colorbar()
#plt.tight_layout()


Out[5]:
<matplotlib.colorbar.Colorbar at 0x10c01db38>

In [7]:
fig, ax = plt.subplots(figsize=(7, 4))
im = plt.imshow(a, interpolation='none', cmap='Greys_r',
                vmin=0, vmax=255)#, norm=mpl.colors.LogNorm(1, 255))
plt.colorbar()
#plt.tight_layout()
plt.xlim(480, 320)
plt.ylim(240, 360)
ax.get_yaxis().set_tick_params(direction='out')
ax.get_xaxis().set_tick_params(direction='out')
plt.savefig('../figures/SI_figure_LCOS_pattern.png', bbox_inches='tight', dpi=300)



In [ ]: